<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  <head>
  		<link rel="shortcut icon" href="http://www.zaih.com/static/front/favicon.ico">
  <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/site/common/css/d0cb53fb.css"/>
  <link rel="stylesheet" href="${pageContext.servletContext.contextPath}/site/common/css/login.css"/>
<script src="${pageContext.servletContext.contextPath}/site/common/js/543987fa.js"></script>
<script src="${pageContext.servletContext.contextPath}/site/common/js/login.js"></script>
<script src="${pageContext.servletContext.contextPath}/site/common/js/4c1cbe90.js"></script>
<script src="${pageContext.servletContext.contextPath}/site/common/js/userinfo/index.js"></script>
<script src="{pageContext.servletContext.contextPath}/site/common/js/analytics.js" async=""></script>
  </head>
  
  <body>
  

<div class="container">
  
  <div id="header" class="header">
    <div class="column">
      <a class="header-logo" href=""></a>
         <ul class="header-nav">
        <li>
          <a href="index">首页</a>
        </li>
        <li data-action="nav-select">
          <a href="curriculumLists">话题分类</a>
          <div class="drop-menu">
            <i class="arrow-up"></i>
            <ul class="drop-list">
              <li>
                <a href="curriculumLists">全部分类</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=学习">学习</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=创新">创新</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=情商">情商</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=思维">思维</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=沟通">沟通</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=生活通识">生活通识</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=实践">实践</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=品格">品格</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=意志">意志</a>
              </li>
              <li>
                <a href="curriculumLists?curriculum.bigTypes=社会公德">社会公德</a>
              </li>
            </ul>
          </div>
        </li>
        <li>
           <form class="search" action="/search" method="GET">
            <input class="search-content" autocomplete="off" placeholder="搜人名、话题" name="word" type="text">
            <input class="search-btn" value="同城搜索" type="submit">
          </form>
        </li>
      </ul>
      
      <div class="to-be-tutor">
        <a href="" target="_blank">成为大墨(老师)</a>
      </div>
      
          <div class="header-setting">
      
              <s:if test="#session.userId != null ">
        <a href="getUsers">${session.nickName }</a>
        <span class="split"></span>
        <a  href="javascript:void(0)" onclick="userOut()" >退出</a>
        </s:if>
      </div>
      
      <div class="app-download">
        <a class="btn-primary app-download-btn" href="" target="_blank">下载客户端</a>
      </div>
    </div>
  </div>
 
  

  
<div class="content">
	<div class="single-column">
		<div class="single-white-wrap">
			<h1>欢迎加入优墨</h1>
			<div class="signup-panel">
                <form method="POST" action="saveRegistered" id="registerId" class="signForm">
                    <div style="display:none;">
                    <input id="csrf_token" name="csrf_token" value="1440584490##cc33a81327cbf4fdbc2ec829c04ae51bb5312671" type="hidden">
                    <input type="hidden" id="checkusernames"></input>
                    <input type="hidden" id="checkcodes"></input>
                    </div>
                    <div class="form-group">
                        <div class="form-item">
                        	<input class="form-control" id="mobile" name="user.userName" onchange="checkmobile()" placeholder="手机号" type="text">
			    			<span class="form-error errForMobile" id="errForMobile"></span>
                        </div>
			    	</div>
                    <div class="form-group">
                        <div class="form-item">
                        	<input class="form-control" id="code" name="code" placeholder="验证码" type="text">
			    			<a href="javascript:void(0);" class="btn-default btn-md getCode">发送验证码</a>
			    			<span class="form-error errForCode" id="errForCode"></span>
                        </div>
			    	</div>
					<div class="form-group">
                        <div class="form-item">
                        	<input class="form-control" id="nickname" name="user.nickName" placeholder="昵称" type="text">
			    			<span class="form-error errForNickname" id="errForNickname"></span>
                        </div>
					</div>
					<div class="form-group">
                        <div class="form-item">
                        
							<select name="user.userType" id="select" >
   								<option select="true" value="1">小墨(学生)</option>
								<option  value="2">大墨(老师)</option>
    						</select>
      					  </div>
					</div>
                    <div class="form-group">
                        <div class="form-item">
	                        <input class="form-control" id="password" name="user.password" placeholder="密码" value="" type="password">
			    			<span class="form-error errForPassword" id="errForPassword"></span>
			    		</div>
                    </div>

                    <div class="deal checkbox-wrap">
                    	<label>
							<input autofocus="" checked="checked" id="readme" onclick="reade()" name="readme" type="checkbox">
							<span class="checkbox checkbox-true" id="checkboxId"><i class="icon icon-checkbox"></i></span>
							我已阅读并同意<a href="" target="_blank">《服务条款》</a>
						</label>
					</div>
					<input type="hidden" id="readeId" name="user.userInfoStatus" value="1"/>
					<script>  
					
function reade(){
if($("#readeId").val()==1){
document.getElementById("readeId").value="2";
}else{
document.getElementById("readeId").value="1";
}}
</script>
                    <!--  <div class="deal">
			    		我已阅读并同意<a href="/help/agreement/" target="_blank">《服务条款》</a>中的内容
			    	</div> -->

			    	<div class="btns-wrap-center">
			    		<button type="button" onclick="sub()"　class="btn-submit btn-hg btn-complete-register">注册</button>
			    	</div>
			    	
			    	<div class="to-login">
						已有账号？现在去<a rel="nofollow" href="Login">登录</a>
					</div>
                </form>
				
			</div>
		</div>
	</div>
</div>
<input type="hidden" id="codeId" value="${session.code }">
<input type="hidden" id="namestatus" value="2">
<script>
  $(function() {
   $("#mobile").blur(function(){
   document.getElementById("checkcodes").value="0";
   var i=document.getElementById("checkusernames").value;
   var mobile=document.getElementById("mobile").value;
   if (mobile == ""){
		$("#errForMobile").html('<p style="color:red;">请输入手机号！</p>');
		return false;
		}else{
			$('#errForMobile').html('');
		}
	if(mobile!=""){
		if(!isMobil(mobile)){
		$("#errForMobile").html('<p style="color:red;">请输入正确的手机号码！</p>');
			return false; 
		}else{
		$('#errForMobile').html('');
		}
	}
	$.ajax({
						url:"checkUserName?user.userName="+mobile,
						data:"",
						type:"post",
						dataType:"text",
							success:function(data){
								if(data==2){
									document.getElementById("checkusernames").value="1";
									$("#errForMobile").html('<p style="color:red;">该手机已经注册，请直接登录</p>');
								}else{
									document.getElementById("checkusernames").value="2";
									$('#errForMobile').html('');
								}
					           }
					          }
					        );
	
   }),
    $("#code").blur(function(){
    var code=document.getElementById("code").value;
    if(code==""){
		$("#errForCode").html('<p style="color:red;">请输入验证码</p>');
		return false;
	}else{
		$('#errForCode').html('');
		}
	if(code!=null){
			$.ajax({
            	url:"checkCode?code="+code,
           		type:'post',
            	data:"",
            	dataType:'text',
            	success:function(data) {
            		document.getElementById("checkcodes").value="1";
              		if(parseInt(data)==2) {
                		$('#errForCode').html('');
                		document.getElementById("checkcodes").value="0";
                		$('#errForCode').html('<p style="color:red;">验证码错误！</p>');
                		return false;
              		}else if(parseInt(data)==3) {
              			document.getElementById("checkcodes").value="0";
                 		$('#errForNickname').html('<p style="color:red;">验证码不能为空不能是空格，请重新输入</p>');
                 		return false;
              		}
            	}
          		});
		
	}else{
		$('#errForCode').html('');
		}
    
    }),
    	 /* $("#nickname").blur(function(){
      	 var username=document.getElementById("nickname").value;
      	 	if(username.length){
		   if(username==""){
            $('#errForNickname').html('<span style="color:red;">用户名不能为空</span>');
            return false;
          }else {
            var regex=/^[0-9A-Za-z_]{4,20}$/;
            if(!regex.exec(username)){
              $('#errForNickname').html('<p style="color:red;">用户名必须输入4~20个字母，数字</p>');
              return false;
            }else{
            	$('#errForNickname').html('');
            	$("#errForNickname").removeAttr("style");
            	$.ajax({
            	url:"checkNickName?user.nickName="+username,
           		type:'post',
            	data:"",
            	dataType:'text',
            	success:function(data) {
              		if(parseInt(data)==2) {
                		$('#errForNickname').html('');
                		$('#errForNickname').html('<p style="color:red;">该用户名已被注册，请重新输入</p>');
                		document.getElementById('namestatus').value = 1;
                		return false;
              		}else if(parseInt(data)==3) {
                 		$('#errForNickname').html('<p style="color:red;">用户名不能是空格，请重新输入</p>');
                 		document.getElementById('namestatus').value = 1;
                 		return false;
              		}
            	}
          		});
            }
          }
	
	}
      	 
      	 }), */
      	 
      	 $("#password").blur(function(){
      	 	var password = $("#password").val();
      	 	if(password.length < 6){
      	 		$("#errForPassword").html('<p style="color:red;">密码长度不能小于6个字符</p>');
      	 	}else if(password.length > 16){
      	 		$("#errForPassword").html('<p style="color:red;">密码长度超过16位</p>');
      	 	}else{
      	 		$('#errForPassword').html('');
      	 	
      	 	}
      	 })
      	 })
</script>

<script>
function sub(e){
var mobile=document.getElementById("mobile").value;
var code=document.getElementById("code").value;
var checkcodes=document.getElementById("checkcodes").value;
var password=document.getElementById("password").value;
var username=document.getElementById("nickname").value;
var checkusername=document.getElementById("checkusernames").value;
/* $(this).parents(".form-item").find(".form-error"); */
	if($("#readeId").val()==2){
      	 	alert("请阅读并勾选同意《服务条款》选项");
	return false;
	}
	if (mobile == ""){
		$("#errForMobile").html('<p style="color:red;">请输入手机号！</p>');
		return false;
		}else{
			$('#errForMobile').html('');
		}
	if(mobile!=""){
		if(!isMobil(mobile)){
		$("#errForMobile").html('<p style="color:red;">请输入正确的手机号码！</p>');
			return false; 
		}else{
		$('#errForMobile').html('');
		}
	}
		if(checkusername=="1"){
		$("#errForMobile").html('<p style="color:red;">该手机已经注册，请直接登录</p>');
		return false;
		}
	if(code==""){
		$("#errForCode").html('<p style="color:red;">请输入验证码</p>');
		return false;
	}else{
		$('#errForCode').html('');
		}
		if(code!=null){
		if(checkcodes=="0"){
		$('#errForCode').html('<p style="color:red;">验证码错误！</p>');
                		return false;
		}
	}else{
		$('#errForCode').html('');
		}
	
		   if(username==""){
            $('#errForNickname').html('<span style="color:red;">用户名不能为空</span>');
            return false;
          }else {
            var regex=/^[0-9A-Za-z_]{4,20}$/;
            if(!regex.exec(username)){
              $('#errForNickname').html('<p style="color:red;">用户名必须输入4~20个字母，数字</p>');
              return false;
            }
          }
	
	if(password.length < 6){
      	 		$("#errForPassword").html('<p style="color:red;">密码长度不能小于6个字符</p>');
      	 		return false;
      	 	}else if(password.length > 16){
      	 		$("#errForPassword").html('<p style="color:red;">密码长度超过16位</p>');
      	 		return false;
      	 	}else{
      	 	$('#errForPassword').html('');
      	 	}
      	 	document.getElementById("checkusernames").value="1";
document.getElementById("registerId").submit();
}
//手机号码验证信息
function isMobil(s)
{
var patrn = /(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/;
if (!patrn.exec(s))
{
return false;
} return true; 
}
$('#login_name').blur(function(){
        
        }); 
</script>

<script>
					function checkmobile(){
					 var mobile=document.getElementById("mobile").value;
					$.ajax({
						url:"checkUserName?user.userName="+mobile,
						data:"",
						type:"post",
						dataType:"text",
							success:function(data){
								if(data==2){
									document.getElementById("checkusernames").value="1";
									$("#errForMobile").html('<p style="color:red;">该手机已经注册，请直接登录</p>');
								}else{
									document.getElementById("checkusernames").value="2";
									$('#errForMobile').html('');
								}
					           }
					          }
					        );
					        }
					</script>
  
  <div class="footer">
    <div class="column">
      <div class="footer-content">
        <div class="footer-left">
          <span class="footer-qr"></span>
          <span>官方微信</span>
        </div>
        <div class="footer-left">
          <span class="footer-qr-salon"></span>
        </div>

        <div class="footer-right">
          <div class="footer-link">
            <a href="index">首页</a>
            <span class="split"></span>
            <a href="">关于我们</a>
            <span class="split"></span>
            <a href="">常见问题</a>
          </div>
          <p>工作日：10:00-19:00</p>
        </div>
      </div>
    </div>
  </div>
  
</div>

<!-- JavaScript at the bottom for fast page loading -->


<script>
var weixin_mp_config = {"appId": "wx63736776bf28c6b5", "nonceStr": "Bc05oCZBs43V", "signature": "49042b7df66740f0ac8f84afd1b3af6d9e7ea5f9", "timestamp": "1440580890"};
</script>

<script>
var weibo_login_url = "/auth/authorize-use/weibo?next=http%3A%2F%2Fwww.zaih.com%2Fauth%2Fsignup%3Fnext%3Dhttp%253A%252F%252Fwww.zaih.com%252F",
    weixin_login_url = "/auth/authorize-use/weixin?next=http%3A%2F%2Fwww.zaih.com%2Fauth%2Fsignup%3Fnext%3Dhttp%253A%252F%252Fwww.zaih.com%252F",
    weixin_mp_login_url = "/auth/authorize-use/weixin_mp?next=http%3A%2F%2Fwww.zaih.com%2Fauth%2Fsignup%3Fnext%3Dhttp%253A%252F%252Fwww.zaih.com%252F",
    signup_url = "/auth/signup?next=http%3A%2F%2Fwww.zaih.com%2Fauth%2Fsignup%3Fnext%3Dhttp%253A%252F%252Fwww.zaih.com%252F";
</script>



<script>
	var page_name = 'signup';
</script>


<!-- end scripts -->

</body>
</html>
